#include <bits/stdc++.h>
#define ll long long
using namespace std;

const int Maxn=5e5+6;
int n,x,A,B;
vector<int>e[Maxn];
int id[Maxn],tot;
int ans=1e9;

multiset<int>s;

void dfs(int u,int ft){
	id[++tot]=u;
	for(auto v:e[u]){
		if(v==ft) continue;
		dfs(v,u);
	}
}

int main(){
	freopen("nim.in","r",stdin);
	freopen("nim.out","w",stdout);
	
	scanf("%d%d%d%d",&n,&x,&A,&B);
	for(int i=1;i<n;i++){
		int u,v;
		scanf("%d%d",&u,&v);
		e[u].emplace_back(v);
		e[v].emplace_back(u);
	}
	
	if(A<=B){
		puts("1");
		return 0;
	}
	
	dfs(x,0);
	int ql=1,qr=0;
	for(int k=1;k<=n/A+1;k++){
		int l=A*k-B+1,r=A*k+B*(k-1);
		l=max(l,1),r=min(r,n);
		if(l>r) continue;
		while(qr<r) ++qr,s.insert(id[qr]);
		while(ql<l) s.erase(s.find(id[ql])),++ql;
		ans=min(ans,*s.begin());
	}
	printf("%d",ans);
	
	return 0;
}
